﻿Imports System
Imports System.Globalization

Namespace System.Workflow.Activities.Rules
    Friend Class BooleanArithmeticLiteral
        Inherits ArithmeticLiteral
        ' Methods
        Friend Sub New(ByVal literalValue As Boolean)
            Me.m_value = literalValue
            MyBase.m_type = GetType(Boolean)
        End Sub

        Friend Overrides Function Add() As Object
            Return Nothing
        End Function

        Friend Overrides Function Add(ByVal v As String) As Object
            Return (v & Me.m_value.ToString(CultureInfo.CurrentCulture))
        End Function

        Friend Overrides Function Add(ByVal v As ArithmeticLiteral) As Object
            Return v.Add(Me.m_value)
        End Function

        Friend Overrides Function BitAnd() As Object
            If Me.m_value Then
                Return Nothing
            End If
            Return False
        End Function

        Friend Overrides Function BitAnd(ByVal v As Boolean) As Object
            Return (v And Me.m_value)
        End Function

        Friend Overrides Function BitAnd(ByVal v As ArithmeticLiteral) As Object
            Return v.BitAnd(Me.m_value)
        End Function

        Friend Overrides Function BitOr() As Object
            If Not Me.m_value Then
                Return Nothing
            End If
            Return True
        End Function

        Friend Overrides Function BitOr(ByVal v As Boolean) As Object
            Return (v Or Me.m_value)
        End Function

        Friend Overrides Function BitOr(ByVal v As ArithmeticLiteral) As Object
            Return v.BitOr(Me.m_value)
        End Function


        ' Properties
        Friend Overrides ReadOnly Property Value As Object
            Get
                Return Me.m_value
            End Get
        End Property


        ' Fields
        Private m_value As Boolean
    End Class
End Namespace

